<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.TreeMap"%>
<%
TreeMap<String, String> check = (TreeMap<String, String>) request.getAttribute("check");
String name = (String) request.getAttribute("name");
TreeMap<String, String> ipAddress = (TreeMap<String, String>) request.getAttribute("ipAddress");

//Set seo content
String title = "Check Ip Location";
String description = "Check ip location info, i.e. country, region, city, latitude, longitude, ZIP code, time zone, connection speed, ISP and domain name, IDD country code, area code, weather station code and name.";
String url = UrlHelper.getServerUrl(request) + "/tool/ip";
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

			<div class="row-fluid">
            
            	<!-- tool detail
        		================================================== -->
            	<div class="span8">
                	<h3 class="toolName">Check Ip Location</h3>
                    <p class="toolDesc">Check ip location info, i.e. country, region, city, latitude, longitude, ZIP code, time zone, connection speed, ISP and domain name, IDD country code, area code, weather station code and name.</p>
                    
                    <!-- form check
        			================================================== -->
                    <form method="get" action="" class="form-inline">
                    	<% if (check != null && check.get("name") != null) { %>
                        <div class="alert alert-error"><%=check.get("name") %></div>
                        <% } %>
                    	<input type="text" placeholder="Enter Ip. ex:74.125.128.138" class="input-xlarge"  value="<%=name != null ? name : "" %>" name="ip" />
                        <button type="submit" class="btn btn-info">check ip</button>                       
                    </form>
                    
                    <!-- result
        			================================================== -->
       				<% if (ipAddress != null && ipAddress.get("ip") != null && !ipAddress.get("ip").isEmpty()) { %>
                    <div class="toolResult">
                    	<h4>ip : <%=name %></h4>
                        <hr />
                        <table class="table table-striped table-bordered table-condensed tool-result-table">
	                        <tbody>
	                          	<tr>
		                            <td>IP</td>
		                            <td><%=ipAddress.get("ip") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Decimal</td>
		                            <td><%=ipAddress.get("decimal") %></td>
	                          	</tr>
	                            <tr>
		                            <td>Hostname</td>
		                            <td><%=ipAddress.get("hostname") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Organization</td>
		                            <td><%=ipAddress.get("organization") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Services</td>
		                            <td><%=ipAddress.get("services") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Type</td>
		                            <td><%=ipAddress.get("type") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Assignment</td>
		                            <td><%=ipAddress.get("assignment") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Country</td>
		                            <td><%=ipAddress.get("country") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Region</td>
		                            <td><%=ipAddress.get("region") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>City</td>
		                            <td><%=ipAddress.get("city") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Latitude</td>
		                            <td><%=ipAddress.get("latitude") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Longitude</td>
		                            <td><%=ipAddress.get("longitude") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Area Code</td>
		                            <td><%=ipAddress.get("areaCode") %></td>
	                          	</tr>
	                          	<tr>
		                            <td>Postal Code</td>
		                            <td><%=ipAddress.get("postalCode") %></td>
	                          	</tr>
	                        </tbody>
	                    </table>
                    </div>
                    <% } %>
                </div>                
                
                <jsp:include page="/elements/right.jsp" />
                
            </div>


<jsp:include page="/layouts/footer.jsp" />